#!/bin/bash
for i in `seq 1 60`
do
    if [ -z  "$(influx -execute 'SHOW DATABASES'|grep  databases)" ];
    then
       echo "sleep 30"
       sleep 30
       echo "wating influxdb start," $i times 30s
       if [ $i == 60 ]; then
         echo "exit init..."
         exit
       fi
    fi

done
echo "start execute..."
influx  -execute 'CREATE DATABASE "host_metrics"'
influx  -execute 'CREATE DATABASE "custom_metrics"'
influx  -execute 'CREATE DATABASE "k8s_metrics"'
influx  -execute 'CREATE DATABASE "prometheus_metrics"'
influx  -execute 'CREATE DATABASE "prometheus"'

if [  -z "$(influx -database 'prometheus' -execute 'SHOW RETENTION POLICIES ON prometheus' | grep k2h_raw)" ]; then
  influx -database 'prometheus' -execute 'CREATE RETENTION POLICY k2h_raw ON prometheus DURATION 2h REPLICATION 1 DEFAULT'
fi
if [  -z "$(influx -database 'prometheus' -execute 'SHOW RETENTION POLICIES ON prometheus' | grep k7d_s5m)" ]; then
  influx -database 'prometheus' -execute 'CREATE RETENTION POLICY k7d_s5m ON prometheus DURATION 7d REPLICATION 1'
fi
if [  -z "$(influx -database 'prometheus' -execute 'SHOW RETENTION POLICIES ON prometheus' | grep k90d_s30m)" ]; then
  influx -database 'prometheus' -execute 'CREATE RETENTION POLICY k90d_s30m ON prometheus DURATION 90d REPLICATION 1 SHARD DURATION 7d'
fi

if [  -z "$(influx -database 'prometheus_metrics' -execute 'SHOW RETENTION POLICIES ON prometheus_metrics' | grep k2h_raw)" ]; then
  influx -database 'prometheus_metrics' -execute 'CREATE RETENTION POLICY k2h_raw ON prometheus_metrics DURATION 2h REPLICATION 1 DEFAULT'
fi
if [  -z "$(influx -database 'prometheus_metrics' -execute 'SHOW RETENTION POLICIES ON prometheus_metrics' | grep k7d_s5m)" ]; then
  influx -database 'prometheus_metrics' -execute 'CREATE RETENTION POLICY k7d_s5m ON prometheus_metrics DURATION 7d REPLICATION 1'
fi
if [  -z "$(influx -database 'prometheus_metrics' -execute 'SHOW RETENTION POLICIES ON prometheus_metrics' | grep k90d_s30m)" ]; then
  influx -database 'prometheus_metrics' -execute 'CREATE RETENTION POLICY k90d_s30m ON prometheus_metrics DURATION 90d REPLICATION 1 SHARD DURATION 7d'
fi
if [  -z "$(influx -database 'k8s_metrics' -execute 'SHOW RETENTION POLICIES ON k8s_metrics' |grep -v shardGroupDuration| grep default)" ]; then
  influx -database 'k8s_metrics' -execute 'CREATE RETENTION POLICY "default" ON k8s_metrics DURATION 2h REPLICATION 1 DEFAULT'
fi
if [  -z "$(influx -database 'k8s_metrics' -execute 'SHOW RETENTION POLICIES ON k8s_metrics' | grep k7d_s5m)" ]; then
  influx -database 'k8s_metrics' -execute 'CREATE RETENTION POLICY k7d_s5m ON k8s_metrics DURATION 7d REPLICATION 1'
fi
if [  -z "$(influx -database 'k8s_metrics' -execute 'SHOW RETENTION POLICIES ON k8s_metrics' | grep k90d_s30m)" ]; then
  influx -database 'k8s_metrics' -execute 'CREATE RETENTION POLICY k90d_s30m ON k8s_metrics DURATION 90d REPLICATION 1 SHARD DURATION 7d'
fi

if [  -z "$(influx -database 'custom_metrics' -execute 'SHOW RETENTION POLICIES ON custom_metrics' | grep k2h_raw)" ]; then
  influx -database 'custom_metrics' -execute 'CREATE RETENTION POLICY "k2h_raw" ON "custom_metrics" DURATION 2h REPLICATION 1 DEFAULT'
fi
if [  -z "$(influx -database 'host_metrics' -execute 'SHOW RETENTION POLICIES ON host_metrics' | grep k2h_raw)" ]; then
  influx -database 'host_metrics' -execute 'CREATE RETENTION POLICY k2h_raw ON host_metrics DURATION 2h REPLICATION 1 DEFAULT'
fi
if [  -z "$(influx -database 'host_metrics' -execute 'SHOW RETENTION POLICIES ON host_metrics' | grep k7d_s5m)" ]; then
  influx -database 'host_metrics' -execute 'CREATE RETENTION POLICY k7d_s5m ON host_metrics DURATION 7d REPLICATION 1'
fi
if [  -z "$(influx -database 'host_metrics' -execute 'SHOW RETENTION POLICIES ON host_metrics' | grep k90d_s30m)" ]; then
  influx -database 'host_metrics' -execute 'CREATE RETENTION POLICY k90d_s30m ON host_metrics DURATION 90d REPLICATION 1 SHARD DURATION 7d'
fi



CONTINUOUS_DATA=$(influx -database 'host_metrics' -execute 'SHOW CONTINUOUS QUERIES')

if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_sample_by_5m)" ]; then
  influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "cpu_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.cpu FROM host_metrics.k2h_raw.cpu GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "cpu_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.cpu FROM host_metrics.k2h_raw.cpu GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep disk_io_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "disk_io_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.disk_io FROM host_metrics.k2h_raw.disk_io GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep disk_io_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "disk_io_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.disk_io FROM host_metrics.k2h_raw.disk_io GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep file_handle_count_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "file_handle_count_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.file_handle_count FROM host_metrics.k2h_raw.file_handle_count GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep file_handle_count_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "file_handle_count_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.file_handle_count FROM host_metrics.k2h_raw.file_handle_count GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep file_system_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "file_system_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.file_system FROM host_metrics.k2h_raw.file_system GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep file_system_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "file_system_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.file_system FROM host_metrics.k2h_raw.file_system GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_inode_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "fs_inode_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.fs_inode FROM host_metrics.k2h_raw.fs_inode GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_inode_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "fs_inode_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.fs_inode FROM host_metrics.k2h_raw.fs_inode GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep interface_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "interface_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.interface FROM host_metrics.k2h_raw.interface GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep interface_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "interface_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.interface FROM host_metrics.k2h_raw.interface GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep load_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "load_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.load FROM host_metrics.k2h_raw.load GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep load_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "load_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.load FROM host_metrics.k2h_raw.load GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep memory_usage_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "memory_usage_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.memory_usage FROM host_metrics.k2h_raw.memory_usage GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep memory_usage_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "memory_usage_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.memory_usage FROM host_metrics.k2h_raw.memory_usage GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep proc_cnt_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "proc_cnt_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.proc_cnt FROM host_metrics.k2h_raw.proc_cnt GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep proc_cnt_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "proc_cnt_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.proc_cnt FROM host_metrics.k2h_raw.proc_cnt GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep proc_fork_rate_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "proc_fork_rate_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.proc_fork_rate FROM host_metrics.k2h_raw.proc_fork_rate GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep proc_fork_rate_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "proc_fork_rate_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.proc_fork_rate FROM host_metrics.k2h_raw.proc_fork_rate GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep tcpconns_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "tcpconns_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.tcpconns FROM host_metrics.k2h_raw.tcpconns GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep tcpconns_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "tcpconns_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.tcpconns FROM host_metrics.k2h_raw.tcpconns GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep uptime_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "uptime_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m.uptime FROM host_metrics.k2h_raw.uptime GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep uptime_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "uptime_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m.uptime FROM host_metrics.k2h_raw.uptime GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep users_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "users_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."users" FROM host_metrics.k2h_raw."users" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep users_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "users_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."users" FROM host_metrics.k2h_raw."users" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep df_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "df_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."df" FROM host_metrics.k2h_raw."df" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep df_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "df_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."df" FROM host_metrics.k2h_raw."df" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep etcdg_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "etcdg_sample_by_5m" ON host_metrics BEGIN SELECT last(gauge) as last_gauge,mean(gauge) as mean_gauge,max(gauge) as max_gauge,min(gauge) as min_gauge INTO host_metrics.k7d_s5m."etcd" FROM host_metrics.k2h_raw."etcd" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep etcdg_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "etcdg_sample_by_30m" ON host_metrics BEGIN SELECT last(gauge) as last_gauge,mean(gauge) as mean_gauge,max(gauge) as max_gauge,min(gauge) as min_gauge INTO host_metrics.k90d_s30m."etcd" FROM host_metrics.k2h_raw."etcd" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep etcdc_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "etcdc_sample_by_5m" ON host_metrics BEGIN SELECT last(counter) as last_counter  INTO host_metrics.k7d_s5m."etcd" FROM host_metrics.k2h_raw."etcd" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep etcdc_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "etcdc_sample_by_30m" ON host_metrics BEGIN SELECT last(counter) as last_counter INTO host_metrics.k90d_s30m."etcd" FROM host_metrics.k2h_raw."etcd" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep kheap_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "kheap_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."kapacitor_heap" FROM host_metrics.k2h_raw."kapacitor_heap" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep kheap_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "kheap_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."kapacitor_heap" FROM host_metrics.k2h_raw."kapacitor_heap" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep ktask_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "ktask_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."kapacitor_task" FROM host_metrics.k2h_raw."kapacitor_task" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep ktask_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "ktask_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."kapacitor_task" FROM host_metrics.k2h_raw."kapacitor_task" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep hmemory_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "hmemory_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."memory" FROM host_metrics.k2h_raw."memory" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep hmemory_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "hmemory_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."memory" FROM host_metrics.k2h_raw."memory" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep nginx_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "nginx_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."nginx" FROM host_metrics.k2h_raw."nginx" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep nginx_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "nginx_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."nginx" FROM host_metrics.k2h_raw."nginx" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep pcpu_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "pcpu_sample_by_5m" ON host_metrics BEGIN SELECT last(*) INTO host_metrics.k7d_s5m."pcpu" FROM host_metrics.k2h_raw."pcpu" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep pcpu_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "pcpu_sample_by_30m" ON host_metrics BEGIN SELECT last(*) INTO host_metrics.k90d_s30m."pcpu" FROM host_metrics.k2h_raw."pcpu" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep ping_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "ping_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."ping" FROM host_metrics.k2h_raw."ping" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep ping_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "ping_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."ping" FROM host_metrics.k2h_raw."ping" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep redis_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "redis_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."redis" FROM host_metrics.k2h_raw."redis" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep redis_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "redis_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."redis" FROM host_metrics.k2h_raw."redis" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep swap_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "swap_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."swap" FROM host_metrics.k2h_raw."swap" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep swap_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "swap_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."swap" FROM host_metrics.k2h_raw."swap" GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep zookeeper_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "zookeeper_sample_by_5m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k7d_s5m."zookeeper" FROM host_metrics.k2h_raw."zookeeper" GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep zookeeper_sample_by_30m)" ]; then
influx -database 'host_metrics' -execute 'CREATE CONTINUOUS QUERY "zookeeper_sample_by_30m" ON host_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO host_metrics.k90d_s30m."zookeeper" FROM host_metrics.k2h_raw."zookeeper" GROUP BY time(30m), * END'
fi
if [ -n "$(echo $CONTINUOUS_DATA |grep cputop5_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'DROP CONTINUOUS QUERY "cputop5_sample_by_5m" ON host_metrics'
fi
if [ -n "$(echo $CONTINUOUS_DATA |grep memtop5_sample_by_5m)" ]; then
influx -database 'host_metrics' -execute 'DROP CONTINUOUS QUERY "memtop5_sample_by_5m" ON host_metrics'
fi


if [ -n "$(echo $CONTINUOUS_DATA |grep cputop5_sample_by_30m)" ]; then
  influx -database 'host_metrics' -execute 'DROP CONTINUOUS QUERY "cputop5_sample_by_30m" ON host_metrics'
fi
if [ -n "$(echo $CONTINUOUS_DATA |grep memtop5_sample_by_30m)" ]; then
  influx -database 'host_metrics' -execute 'DROP CONTINUOUS QUERY "memtop5_sample_by_30m" ON host_metrics'
fi


if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_limit_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_limit_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"cpu/limit\" FROM k8s_metrics.\"default\".\"cpu/limit\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_limit_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_limit_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"cpu/limit\" FROM k8s_metrics.\"default\".\"cpu/limit\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_node_utilization_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_node_utilization_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"cpu/node_utilization\" FROM k8s_metrics.\"default\".\"cpu/node_utilization\" GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_node_utilization_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_node_utilization_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"cpu/node_utilization\" FROM k8s_metrics.\"default\".\"cpu/node_utilization\" GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_request_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_request_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"cpu/request\" FROM k8s_metrics.\"default\".\"cpu/request\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_request_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_request_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"cpu/request\" FROM k8s_metrics.\"default\".\"cpu/request\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_usage_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_usage_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"cpu/usage\" FROM k8s_metrics.\"default\".\"cpu/usage\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_usage_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_usage_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"cpu/usage\" FROM k8s_metrics.\"default\".\"cpu/usage\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_usage_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_usage_rate_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"cpu/usage_rate\" FROM k8s_metrics.\"default\".\"cpu/usage_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep cpu_usage_rate_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"cpu_usage_rate_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"cpu/usage_rate\" FROM k8s_metrics.\"default\".\"cpu/usage_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep io_read_bytes_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"io_read_bytes_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"disk/io_read_bytes\" FROM k8s_metrics.\"default\".\"disk/io_read_bytes\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep io_read_bytes_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"io_read_bytes_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"disk/io_read_bytes\" FROM k8s_metrics.\"default\".\"disk/io_read_bytes\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep io_write_bytes_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"io_write_bytes_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"disk/io_write_bytes\" FROM k8s_metrics.\"default\".\"disk/io_write_bytes\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep io_write_bytes_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"io_write_bytes_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"disk/io_write_bytes\" FROM k8s_metrics.\"default\".\"disk/io_write_bytes\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep io_read_bytes_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"io_read_bytes_rate_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"disk/io_read_bytes_rate\" FROM k8s_metrics.\"default\".\"disk/io_read_bytes_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep io_read_bytes_rate_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"io_read_bytes_rate_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"disk/io_read_bytes_rate\" FROM k8s_metrics.\"default\".\"disk/io_read_bytes_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep io_write_bytes_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"io_write_bytes_rate_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"disk/io_write_bytes_rate\" FROM k8s_metrics.\"default\".\"disk/io_write_bytes_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep io_write_bytes_rate_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"io_write_bytes_rate_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"disk/io_write_bytes_rate\" FROM k8s_metrics.\"default\".\"disk/io_write_bytes_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_available_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_available_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"filesystem/available\" FROM k8s_metrics.\"default\".\"filesystem/available\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_available_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_available_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"filesystem/available\" FROM k8s_metrics.\"default\".\"filesystem/available\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_inodes_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_inodes_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"filesystem/inodes\" FROM k8s_metrics.\"default\".\"filesystem/inodes\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_inodes_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_inodes_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"filesystem/inodes\" FROM k8s_metrics.\"default\".\"filesystem/inodes\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_inodes_free_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_inodes_free_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"filesystem/inodes_free\" FROM k8s_metrics.\"default\".\"filesystem/inodes_free\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_inodes_free_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_inodes_free_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"filesystem/inodes_free\" FROM k8s_metrics.\"default\".\"filesystem/inodes_free\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_limit_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_limit_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"filesystem/limit\" FROM k8s_metrics.\"default\".\"filesystem/limit\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_limit_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_limit_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"filesystem/limit\" FROM k8s_metrics.\"default\".\"filesystem/limit\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_usage_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_usage_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"filesystem/usage\" FROM k8s_metrics.\"default\".\"filesystem/usage\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep fs_usage_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"fs_usage_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"filesystem/usage\" FROM k8s_metrics.\"default\".\"filesystem/usage\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_major_faults_rate_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_major_faults_rate_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"memory/major_page_faults_rate\" FROM k8s_metrics.\"default\".\"memory/major_page_faults_rate\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_page_faults_rate_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_page_faults_rate_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"memory/page_faults_rate\" FROM k8s_metrics.\"default\".\"memory/page_faults_rate\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_major_faults_rate_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_major_faults_rate_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"memory/major_page_faults_rate\" FROM k8s_metrics.\"default\".\"memory/major_page_faults_rate\"  where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_page_faults_rate_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_page_faults_rate_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"memory/page_faults_rate\" FROM k8s_metrics.\"default\".\"memory/page_faults_rate\" where value !=0 and nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_node_alloc_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_node_alloc_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"memory/node_allocatable\" FROM k8s_metrics.\"default\".\"memory/node_allocatable\"  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_node_alloc_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_node_alloc_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"memory/node_allocatable\" FROM k8s_metrics.\"default\".\"memory/node_allocatable\" GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_node_capa_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_node_capa_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"memory/node_capacity\" FROM k8s_metrics.\"default\".\"memory/node_capacity\"  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_node_capa_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_node_capa_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"memory/node_capacity\" FROM k8s_metrics.\"default\".\"memory/node_capacity\" GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_node_reser_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_node_reser_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"memory/node_reservation\" FROM k8s_metrics.\"default\".\"memory/node_reservation\"  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_node_reser_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_node_reser_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"memory/node_reservation\" FROM k8s_metrics.\"default\".\"memory/node_reservation\" GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_node_util_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_node_util_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"memory/node_utilization\" FROM k8s_metrics.\"default\".\"memory/node_utilization\"  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_node_util_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_node_util_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"memory/node_utilization\" FROM k8s_metrics.\"default\".\"memory/node_utilization\"  GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_request_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_request_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"memory/request\" FROM k8s_metrics.\"default\".\"memory/request\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_request_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_request_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"memory/request\" FROM k8s_metrics.\"default\".\"memory/request\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_limit_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_limit_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"memory/limit\" FROM k8s_metrics.\"default\".\"memory/limit\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_limit_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_limit_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"memory/limit\" FROM k8s_metrics.\"default\".\"memory/limit\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_rss_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_rss_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"memory/rss\" FROM k8s_metrics.\"default\".\"memory/rss\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_rss_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_rss_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"memory/rss\" FROM k8s_metrics.\"default\".\"memory/rss\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_usage_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_usage_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"memory/usage\" FROM k8s_metrics.\"default\".\"memory/usage\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_usage_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_usage_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"memory/usage\" FROM k8s_metrics.\"default\".\"memory/usage\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_working_set_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_working_set_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"memory/working_set\" FROM k8s_metrics.\"default\".\"memory/working_set\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_working_set_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_working_set_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"memory/working_set\" FROM k8s_metrics.\"default\".\"memory/working_set\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_cache_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_cache_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"memory/cache\" FROM k8s_metrics.\"default\".\"memory/cache\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep mem_cache_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"mem_cache_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"memory/cache\" FROM k8s_metrics.\"default\".\"memory/cache\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_rx_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_rx_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"network/rx\" FROM k8s_metrics.\"default\".\"network/rx\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_rx_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_rx_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"network/rx\" FROM k8s_metrics.\"default\".\"network/rx\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_tx_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_tx_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"network/tx\" FROM k8s_metrics.\"default\".\"network/tx\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_tx_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_tx_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"network/tx\" FROM k8s_metrics.\"default\".\"network/tx\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_rx_errors_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_rx_errors_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"network/rx_errors\" FROM k8s_metrics.\"default\".\"network/rx_errors\"  where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_rx_errors_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_rx_errors_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"network/rx_errors\" FROM k8s_metrics.\"default\".\"network/rx_errors\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_tx_errors_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_tx_errors_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"network/tx_errors\" FROM k8s_metrics.\"default\".\"network/tx_errors\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_tx_errors_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_tx_errors_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"network/tx_errors\" FROM k8s_metrics.\"default\".\"network/tx_errors\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_tx_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_tx_rate_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"network/tx_rate\" FROM k8s_metrics.\"default\".\"network/tx_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_tx_rate_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_tx_rate_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"network/tx_rate\" FROM k8s_metrics.\"default\".\"network/tx_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_rx_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_rx_rate_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"network/rx_rate\" FROM k8s_metrics.\"default\".\"network/rx_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_rx_rate_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_rx_rate_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"network/rx_rate\" FROM k8s_metrics.\"default\".\"network/rx_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_tx_errors_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_tx_errors_rate_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"network/tx_errors_rate\" FROM k8s_metrics.\"default\".\"network/tx_errors_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_tx_errors_rate_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_tx_errors_rate_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"network/tx_errors_rate\" FROM k8s_metrics.\"default\".\"network/tx_errors_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_rx_errors_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_rx_errors_rate_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k7d_s5m.\"network/rx_errors_rate\" FROM k8s_metrics.\"default\".\"network/rx_errors_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6'  GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep network_rx_errors_rate_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"network_rx_errors_rate_by_30m\" ON k8s_metrics BEGIN SELECT last(*),mean(*),max(*),min(*) INTO k8s_metrics.k90d_s30m.\"network/rx_errors_rate\" FROM k8s_metrics.\"default\".\"network/rx_errors_rate\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep restart_count_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"restart_count_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"restart_count\" FROM k8s_metrics.\"default\".\"restart_count\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep restart_count_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"restart_count_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"restart_count\" FROM k8s_metrics.\"default\".\"restart_count\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep uptime_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"uptime_sample_by_5m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k7d_s5m.\"uptime\" FROM k8s_metrics.\"default\".\"uptime\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(5m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep uptime_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute "CREATE CONTINUOUS QUERY \"uptime_sample_by_30m\" ON k8s_metrics BEGIN SELECT last(value) INTO k8s_metrics.k90d_s30m.\"uptime\" FROM k8s_metrics.\"default\".\"uptime\" where nodename<>'172.16.24.2' and nodename<>'172.16.24.72' and nodename<>'172.16.82.5' and nodename<>'172.16.82.6' GROUP BY time(30m), * END"
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_usage_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute 'CREATE CONTINUOUS QUERY "container_memory_usage_rate_sample_by_5m" ON "k8s_metrics" BEGIN SELECT last(*), mean(*), max(*), min(*) INTO k8s_metrics.k7d_s5m."memory/usage_rate" FROM "memory/usage_rate" GROUP BY time(5m),* END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_usage_rate_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute 'CREATE CONTINUOUS QUERY "container_memory_usage_rate_sample_by_30m" ON "k8s_metrics" BEGIN SELECT last(*), mean(*), max(*), min(*) INTO k8s_metrics.k90d_s30m."memory/usage_rate" FROM "memory/usage_rate" GROUP BY time(30m),* END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_usage_rate_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute 'CREATE CONTINUOUS QUERY "container_cpu_usage_rate_sample_by_5m" ON "k8s_metrics" BEGIN SELECT last(*), mean(*), max(*), min(*) INTO k8s_metrics.k7d_s5m."zcm_container/cpu_usage_rate" FROM "zcm_container/cpu_usage_rate" GROUP BY time(5m),* END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_usage_rate_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute 'CREATE CONTINUOUS QUERY "container_cpu_usage_rate_sample_by_30m" ON "k8s_metrics" BEGIN SELECT last(*), mean(*), max(*), min(*) INTO k8s_metrics.k90d_s30m."zcm_container/cpu_usage_rate" FROM "zcm_container/cpu_usage_rate" GROUP BY time(30m),* END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_usage_sample_by_5m)" ]; then
influx -database 'k8s_metrics' -execute 'CREATE CONTINUOUS QUERY "container_memory_usage_sample_by_5m" ON "k8s_metrics" BEGIN SELECT last(*), mean(*), max(*), min(*) INTO k8s_metrics.k7d_s5m."zcm_container/memory_usage" FROM "zcm_container/memory_usage" GROUP BY time(5m),* END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_usage_sample_by_30m)" ]; then
influx -database 'k8s_metrics' -execute 'CREATE CONTINUOUS QUERY "container_memory_usage_sample_by_30m" ON "k8s_metrics" BEGIN SELECT last(*), mean(*), max(*), min(*) INTO k8s_metrics.k90d_s30m."zcm_container/memory_usage" FROM "zcm_container/memory_usage" GROUP BY time(30m),* END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_load_average_10s_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_cpu_load_average_10s_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_cpu_load_average_10s" FROM prometheus_metrics."k2h_raw"."container_cpu_load_average_10s"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_load_average_10s_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_cpu_load_average_10s_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_cpu_load_average_10s" FROM prometheus_metrics."k2h_raw"."container_cpu_load_average_10s"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_usage_seconds_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_cpu_usage_seconds_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_cpu_usage_seconds_total" FROM prometheus_metrics."k2h_raw"."container_cpu_usage_seconds_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_usage_seconds_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_cpu_usage_seconds_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_cpu_usage_seconds_total" FROM prometheus_metrics."k2h_raw"."container_cpu_usage_seconds_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_user_seconds_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_cpu_user_seconds_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_cpu_user_seconds_total" FROM prometheus_metrics."k2h_raw"."container_cpu_user_seconds_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_user_seconds_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_cpu_user_seconds_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_cpu_user_seconds_total" FROM prometheus_metrics."k2h_raw"."container_cpu_user_seconds_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_system_seconds_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_cpu_system_seconds_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_cpu_system_seconds_total" FROM prometheus_metrics."k2h_raw"."container_cpu_system_seconds_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_cpu_system_seconds_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_cpu_system_seconds_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_cpu_system_seconds_total" FROM prometheus_metrics."k2h_raw"."container_cpu_system_seconds_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_spec_cpu_quota_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_spec_cpu_quota_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_spec_cpu_quota" FROM prometheus_metrics."k2h_raw"."container_spec_cpu_quota"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_spec_cpu_quota_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_spec_cpu_quota_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_spec_cpu_quota" FROM prometheus_metrics."k2h_raw"."container_spec_cpu_quota"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_network_receive_bytes_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_network_receive_bytes_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_network_receive_bytes_total" FROM prometheus_metrics."k2h_raw"."container_network_receive_bytes_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_network_receive_bytes_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_network_receive_bytes_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_network_receive_bytes_total" FROM prometheus_metrics."k2h_raw"."container_network_receive_bytes_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_network_transmit_bytes_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_network_transmit_bytes_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_network_transmit_bytes_total" FROM prometheus_metrics."k2h_raw"."container_network_transmit_bytes_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_network_transmit_bytes_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_network_transmit_bytes_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_network_transmit_bytes_total" FROM prometheus_metrics."k2h_raw"."container_network_transmit_bytes_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_last_seen_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_last_seen_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_last_seen" FROM prometheus_metrics."k2h_raw"."container_last_seen"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_last_seen_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_last_seen_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_last_seen" FROM prometheus_metrics."k2h_raw"."container_last_seen"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_cache_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_cache_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_memory_cache" FROM prometheus_metrics."k2h_raw"."container_memory_cache"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_cache_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_cache_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_memory_cache" FROM prometheus_metrics."k2h_raw"."container_memory_cache"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_rss_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_rss_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_memory_rss" FROM prometheus_metrics."k2h_raw"."container_memory_rss"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_rss_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_rss_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_memory_rss" FROM prometheus_metrics."k2h_raw"."container_memory_rss"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_swap_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_swap_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_memory_swap" FROM prometheus_metrics."k2h_raw"."container_memory_swap"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_swap_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_swap_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_memory_swap" FROM prometheus_metrics."k2h_raw"."container_memory_swap"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_usage_bytes_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_usage_bytes_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_memory_usage_bytes" FROM prometheus_metrics."k2h_raw"."container_memory_usage_bytes"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_usage_bytes_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_usage_bytes_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_memory_usage_bytes" FROM prometheus_metrics."k2h_raw"."container_memory_usage_bytes"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_working_set_bytes_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_working_set_bytes_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_memory_working_set_bytes" FROM prometheus_metrics."k2h_raw"."container_memory_working_set_bytes"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_working_set_bytes_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_working_set_bytes_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_memory_working_set_bytes" FROM prometheus_metrics."k2h_raw"."container_memory_working_set_bytes"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_spec_memory_limit_bytes_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_spec_memory_limit_bytes_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_spec_memory_limit_bytes" FROM prometheus_metrics."k2h_raw"."container_spec_memory_limit_bytes"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_spec_memory_limit_bytes_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_spec_memory_limit_bytes_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_spec_memory_limit_bytes" FROM prometheus_metrics."k2h_raw"."container_spec_memory_limit_bytes"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_usage_rate_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_usage_rate_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_memory_usage_rate" FROM prometheus_metrics."k2h_raw"."container_memory_usage_rate"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_memory_usage_rate_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_memory_usage_rate_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_memory_usage_rate" FROM prometheus_metrics."k2h_raw"."container_memory_usage_rate"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_inodes_free_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_inodes_free_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_inodes_free" FROM prometheus_metrics."k2h_raw"."container_fs_inodes_free"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_inodes_free_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_inodes_free_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_inodes_free" FROM prometheus_metrics."k2h_raw"."container_fs_inodes_free"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_inodes_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_inodes_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_inodes_total" FROM prometheus_metrics."k2h_raw"."container_fs_inodes_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_inodes_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_inodes_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_inodes_total" FROM prometheus_metrics."k2h_raw"."container_fs_inodes_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_io_current_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_io_current_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_io_current" FROM prometheus_metrics."k2h_raw"."container_fs_io_current"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_io_current_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_io_current_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_io_current" FROM prometheus_metrics."k2h_raw"."container_fs_io_current"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_io_time_seconds_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_io_time_seconds_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_io_time_seconds_total" FROM prometheus_metrics."k2h_raw"."container_fs_io_time_seconds_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_io_time_seconds_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_io_time_seconds_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_io_time_seconds_total" FROM prometheus_metrics."k2h_raw"."container_fs_io_time_seconds_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_io_time_weighted_seconds_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_io_time_weighted_seconds_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_io_time_weighted_seconds_total" FROM prometheus_metrics."k2h_raw"."container_fs_io_time_weighted_seconds_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_io_time_weighted_seconds_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_io_time_weighted_seconds_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_io_time_weighted_seconds_total" FROM prometheus_metrics."k2h_raw"."container_fs_io_time_weighted_seconds_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_limit_bytes_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_limit_bytes_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_limit_bytes" FROM prometheus_metrics."k2h_raw"."container_fs_limit_bytes"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_limit_bytes_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_limit_bytes_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_limit_bytes" FROM prometheus_metrics."k2h_raw"."container_fs_limit_bytes"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_usage_bytes_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_usage_bytes_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_usage_bytes" FROM prometheus_metrics."k2h_raw"."container_fs_usage_bytes"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_usage_bytes_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_usage_bytes_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_usage_bytes" FROM prometheus_metrics."k2h_raw"."container_fs_usage_bytes"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_read_seconds_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_read_seconds_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_read_seconds_total" FROM prometheus_metrics."k2h_raw"."container_fs_read_seconds_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_read_seconds_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_read_seconds_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_read_seconds_total" FROM prometheus_metrics."k2h_raw"."container_fs_read_seconds_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_reads_bytes_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_reads_bytes_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_reads_bytes_total" FROM prometheus_metrics."k2h_raw"."container_fs_reads_bytes_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_reads_bytes_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_reads_bytes_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_reads_bytes_total" FROM prometheus_metrics."k2h_raw"."container_fs_reads_bytes_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_write_seconds_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_write_seconds_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_write_seconds_total" FROM prometheus_metrics."k2h_raw"."container_fs_write_seconds_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_write_seconds_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_write_seconds_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_write_seconds_total" FROM prometheus_metrics."k2h_raw"."container_fs_write_seconds_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_writes_bytes_total_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_writes_bytes_total_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_fs_writes_bytes_total" FROM prometheus_metrics."k2h_raw"."container_fs_writes_bytes_total"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_fs_writes_bytes_total_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_fs_writes_bytes_total_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_fs_writes_bytes_total" FROM prometheus_metrics."k2h_raw"."container_fs_writes_bytes_total"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_start_time_seconds_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_start_time_seconds_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_start_time_seconds" FROM prometheus_metrics."k2h_raw"."container_start_time_seconds"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_start_time_seconds_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_start_time_seconds_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_start_time_seconds" FROM prometheus_metrics."k2h_raw"."container_start_time_seconds"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_file_descriptors_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_file_descriptors_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_file_descriptors FROM prometheus_metrics.k2h_raw.container_file_descriptors GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_file_descriptors_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_file_descriptors_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_file_descriptors FROM prometheus_metrics.k2h_raw.container_file_descriptors GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_processes_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_processes_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_processes FROM prometheus_metrics.k2h_raw.container_processes GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_processes_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_processes_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_processes FROM prometheus_metrics.k2h_raw.container_processes GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_sockets_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_sockets_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_sockets FROM prometheus_metrics.k2h_raw.container_sockets GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_sockets_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_sockets_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_sockets FROM prometheus_metrics.k2h_raw.container_sockets GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_threads_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_threads_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_threads FROM prometheus_metrics.k2h_raw.container_threads GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_threads_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_threads_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_threads FROM prometheus_metrics.k2h_raw.container_threads GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_ulimits_soft_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_ulimits_soft_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_ulimits_soft FROM prometheus_metrics.k2h_raw.container_ulimits_soft GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_ulimits_soft_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_ulimits_soft_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_ulimits_soft FROM prometheus_metrics.k2h_raw.container_ulimits_soft GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_file_descriptors_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_file_descriptors_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_file_descriptors FROM prometheus_metrics.k2h_raw.container_file_descriptors GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_file_descriptors_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_file_descriptors_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_file_descriptors FROM prometheus_metrics.k2h_raw.container_file_descriptors GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_processes_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_processes_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_processes FROM prometheus_metrics.k2h_raw.container_processes GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_processes_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_processes_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_processes FROM prometheus_metrics.k2h_raw.container_processes GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_sockets_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_sockets_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_sockets FROM prometheus_metrics.k2h_raw.container_sockets GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_sockets_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_sockets_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_sockets FROM prometheus_metrics.k2h_raw.container_sockets GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_threads_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_threads_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_threads FROM prometheus_metrics.k2h_raw.container_threads GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_threads_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_threads_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_threads FROM prometheus_metrics.k2h_raw.container_threads GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_ulimits_soft_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_ulimits_soft_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m.container_ulimits_soft FROM prometheus_metrics.k2h_raw.container_ulimits_soft GROUP BY time(5m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_ulimits_soft_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_ulimits_soft_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m.container_ulimits_soft FROM prometheus_metrics.k2h_raw.container_ulimits_soft GROUP BY time(30m), * END'
fi

if [ -z "$(echo $CONTINUOUS_DATA |grep container_stats_summary_fs_inodes_stat_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_stats_summary_fs_inodes_stat_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_stats_summary_fs_inodes_stat" FROM prometheus_metrics."k2h_raw"."container_stats_summary_fs_inodes_stat"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_stats_summary_fs_inodes_stat_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_stats_summary_fs_inodes_stat_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_stats_summary_fs_inodes_stat" FROM prometheus_metrics."k2h_raw"."container_stats_summary_fs_inodes_stat"  GROUP BY time(30m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_stats_summary_fs_used_bytes_by_5m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_stats_summary_fs_used_bytes_by_5m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k7d_s5m."container_stats_summary_fs_used_bytes" FROM prometheus_metrics."k2h_raw"."container_stats_summary_fs_used_bytes"  GROUP BY time(5m), * END'
fi
if [ -z "$(echo $CONTINUOUS_DATA |grep container_stats_summary_fs_used_bytes_by_30m)" ]; then
influx -database 'prometheus_metrics' -execute 'CREATE CONTINUOUS QUERY container_stats_summary_fs_used_bytes_by_30m ON prometheus_metrics BEGIN SELECT last(*), mean(*), max(*), min(*) INTO prometheus_metrics.k90d_s30m."container_stats_summary_fs_used_bytes" FROM prometheus_metrics."k2h_raw"."container_stats_summary_fs_used_bytes"  GROUP BY time(30m), * END'
fi

echo   "exec influx end..."
sh /report_series.sh